/**
 * 获取 接口基地址
 * @param isProxy 是否是proxy代理
 * @param env 环境变量
 * @returns
 */
export const getServerBaseURL = (isProxy: boolean, env = BUILD_ENV) => {
    /** 请求地址 */
    const serverBaseURL: Record<typeof BUILD_ENV, string> = {
        dev: 'https://api-engineer-country-test.busionline.com',
        test: 'https://api-engineer-country-test.busionline.com',
        pre: 'http://pre-chinajob.busionline.com:8802',
        // pro: 'https://chinajob.busionline.com:8002',
        pro: 'http://chinajob.mohrss.gov.cn:8002',
    }
    /** proxy代理地址 */
    const proxyServerBaseURL: Pick<Record<typeof BUILD_ENV, string>, 'dev'> = {
        dev: '/proxyApi',
    }

    if (env === 'dev' && isProxy) {
        return proxyServerBaseURL[env]
    } else {
        return serverBaseURL[env as typeof BUILD_ENV]
    }
}

/** 获取oss静态资源地址 */
export const getPublicBaseURL = (env = BUILD_ENV) => {
    const publicURL: Record<typeof BUILD_ENV, string> = {
        dev: '/',
        test: 'https://web-country-test.busionline.com/mobile/',
        pre: 'http://pre-chinajob.busionline.com:8801/mobile/',
        // pro: 'https://chinajob.busionline.com:8001/mobile/',
        pro: 'http://chinajob.mohrss.gov.cn:8001/mobile/',
    }

    return publicURL[env as typeof BUILD_ENV]
}
